/**
 * @param {number} n
 * @return {number}
 */
 var nthUglyNumber = function(n) {
    if(n==1){
        return 1;
    }
    var mapper=new Map();
    mapper.set(1,1);
    mapper.set(2,1);
    mapper.set(3,1);
    mapper.set(5,1);
    let count=1;
    let go=2;
    while(count<n){
        if(mapper.has(go/2)||mapper.has(go/3)||mapper.has(go/5)){
            mapper.set(go,1);
            count++;
        }
        go++;
    }
    return go-1;
};

console.log(nthUglyNumber(1690))